{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "a6fae042",
   "metadata": {},
   "outputs": [],
   "source": [
    "class Person:\n",
    "    \n",
    "    def __init__(self,name,age):\n",
    "        self.name=name\n",
    "        self.age=age\n",
    "        \n",
    "    def sing(self):\n",
    "        print(\"人在唱歌\")\n",
    "    \n",
    "    def run(self,other):\n",
    "        print(f\"run with {other}\")\n",
    "        \n",
    "\n",
    "class Student(Person):\n",
    "    \n",
    "    def __init__(self,name,age,score):\n",
    "        self.score=score\n",
    "        Person.__init__(self,name,age)\n",
    "        \n",
    "    def dance(self,other):\n",
    "        print(\"人在跳舞\")\n",
    "        super().run(other)\n",
    "    \n",
    "    def sing(self,song):\n",
    "        print(f\"人在唱{song}\")\n",
    "\n",
    "class Teacher(Person):\n",
    "    pass"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "02570def",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "人在唱茉莉花\n"
     ]
    }
   ],
   "source": [
    "s1 = Student(\"张三\",18,100)\n",
    "s1.sing(\"茉莉花\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "b94f28b1",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "人在跳舞\n",
      "run with lfx\n"
     ]
    }
   ],
   "source": [
    "s1.dance(\"lfx\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "eac274a1",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "my_test",
   "language": "python",
   "name": "my_test"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
